HTML (HyperText Markup Language) is the standard markup language for
creating web pages. It describes the structure of a webpage and is
used to organize and format content.
HTML consists of a series of elements which you use to enclose, or
wrap, different parts of the content to make it appear or act in a
certain way.
What you should already know
This guide assumes you have the following basic background:
- A basic understanding of how the Internet works.
- Basic familiarity with using a web browser.
HTML uses a set of elements to structure content. Each element has a
meaning and purpose.
A basic HTML document starts with a doctype declaration followed by
the html, head, and body elements.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html>
HTML elements are building blocks of HTML. An element is defined by
a start tag, some content, and an end tag.
Example:
<p>This is a paragraph.</p>
HTML attributes provide additional information about HTML elements.
Attributes are always included in the opening tag and usually come
in name/value pairs.
Example:
<a href="https://www.example.com">This is a link</a>
HTML tables are used to display tabular data. A table is defined
using the <table> element and contains rows and columns.
Example:
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>John</td>
<td>30</td>
</tr>
</table>
Semantic HTML elements clearly describe their meaning in a human-
and machine-readable way. Examples include <article>,
<section>, <nav>, <header>, and <footer>.
Example:
<article>
<header>
<h1>Article Title</h1>
</header>
<p>This is an article.</p>
</article>
HTML5 is the latest version of HTML, which includes new elements,
attributes, and behaviors, as well as a larger set of technologies
that allow for more diverse and powerful web applications.
New elements include:
- <header>
- <footer>
- <article>
- <section>
- <nav>
Writing clean, semantic HTML helps improve accessibility, search
engine optimization, and maintainability of your code.
Some best practices include:
- Use semantic elements appropriately.
- Keep your HTML well-structured and organized.
- Validate your HTML to ensure it meets web standards.